package com.chushouya.order.constants;



import com.general.framework.core.enums.IEnum;
import com.general.framework.core.lang.Strings;

import java.util.Objects;

/**
 * 订单物流状态枚举
 * -1无 0待发货 1已发货 2已收货
 */
public enum LogisticsStatusEnum implements IEnum<Integer> {

    NONE(-1, "-"),
    WAIT_DELIVERY(0, "待发货"),
    HAS_DELIVERY(1, "已发货"),
    HAS_RECEIPT(2, "已收货"),
    TRANSPORT(3, "运输中");


    private Integer value;

    private String desc;

    LogisticsStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String getDesc(Integer value) {
        for (LogisticsStatusEnum thisEnum : LogisticsStatusEnum.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }

    @Override
    public Integer value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }
}
